package ca.etsmtl.log430.lab3;

import java.util.Observable;

public class ListCoursesNotFollowed extends Communication{

	public ListCoursesNotFollowed(Integer registrationNumber, String componentName) {
		super(registrationNumber, componentName);
	}
	
	public void update(Observable thing, Object notificationNumber) {
		Menus menu = new Menus();
		Displays display = new Displays();
		Student myStudent = new Student();

		if (registrationNumber.compareTo((Integer) notificationNumber) == 0) {
			addToReceiverList("ListStudentsComponent");
			signalReceivers("ListStudentsComponent");
			myStudent = menu.pickStudent(CommonData.theListOfStudents.listOfStudents);

			if (myStudent != null) {
				/*
				 * If the course is valid (exists in the list), them we display
				 * the students that are stored in the course object's internal
				 * list
				 */
				display.displayStudentCoursesNotFollowed(myStudent);
			} else {
				System.out.println("\n\n *** Course not found ***");
			}
		}
		removeFromReceiverList("ListCoursesComponent");
	}
	

}
